<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%  
	String path = request.getContextPath();  
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";  
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>消费情况</title>
<jsp:include page="/WEB-INF/backstage/util.jsp"/>
<%-- <link rel="stylesheet" href="${pageContext.request.contextPath }/js/common/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="${pageContext.request.contextPath }/js/common/bootstrap/css/bootstrap-theme.min.css">
<script src="${pageContext.request.contextPath }/js/jquery-3.1.1.min.js"></script>
<script	src="${pageContext.request.contextPath }/js/common/bootstrap/js/bootstrap.min.js"></script>
<script	src="${pageContext.request.contextPath }/js/common/bootstrapvaildator/js/bootstrapValidator.min.js"></script>
<script	src="${pageContext.request.contextPath }/js/common/bootstrapvaildator/js/language/zh_CN.js"></script> --%>
</head>
<body>
<!-- <body style="margin: 30px;"> -->
<body>
		<center>
			<!-- 条件查询表单 -->
				<form class="form-inline" action="${pageContext.request.contextPath }/zjj/selectBis_business_order" method="post" name="myform" id="myform">
					<input type="hidden"name="custom_user_id" value="${custom_user_id }"/>
					<table>
						<tr align="center">
							<td align="right">
								<div class="form-group">
									<label for="order_id">订单编号：</label>
								</div>
							</td>
							<td align="left">
								<div class="form-group">
									<input type="text" class="form-control" id="order_id" name="order_id" value="${order_id }" >
								</div>
							</td>
							<td align="right">
								<div class="form-group">
									<label for="order_content">消费内容：</label>
								</div>
							</td>
							<td align="left">
								<div class="form-group">
									<input type="text" class="form-control" id="order_content" name="order_content" value="${order_content }">
								</div>
							</td>
							<td align="right">
								<div class="form-group">
									<label for="pay_way">支付方式：</label>
								</div>
							</td>
							<td align="left">
								<div class="form-group">
									<select class="form-control" name="pay_way" id="pay_way">
									  <option value="" selected="selected">请选择~！</option>
									  <option value="1">微信</option>
									  <option value="2">支付宝</option>
									  <option value="3">美颜币</option>
									  <option value="4">套餐</option>
									</select>
								</div>
							</td>
							<td align="right">
								<div class="form-group">
									<label for="order_status">订单状态：</label>
								</div>
							</td>
							<td align="left">
								<div class="form-group">
									<select class="form-control" name="order_status" id="order_status">
									  	<option value="" selected="selected">请选择~！</option>
									  	<option value="0">草稿</option>
										<option value="1">已预约</option>
										<option value="2">服务中</option>
										<option value="3">待支付</option>
										<option value="4">已支付</option>
										<option value="5">已完成</option>
										<option value="6">已过期</option>
										<option value="7">已撤销</option>
									</select>
								</div>
							</td>
						</tr>
						<tr align="center">
							<td align="right">
								<div class="form-group">
									<label for="shop_id">店铺名称：</label>
								</div>
							</td>
							<td align="left">
								<div class="form-group">
									<select class="form-control" name="shop_id" id="shop_id">
									  	<option value="" selected="selected">请选择~！</option>
									  	<c:forEach items="${list2 }" var="list2">
											<option value="${list2.shop_id }">${list2.shop_name }</option>
										</c:forEach>
									</select>
								</div>
							</td>
							<td align="right">
								<div class="form-group">
									<label for="server_user_id">服务员工：</label>
								</div>
							</td>
							<td align="left">
								<div class="form-group">
									<input type="text" class="form-control" id="server_user_id" name="server_user_id" value="${server_user_id }">
								</div>
							</td>
							<td align="right">
								<div class="form-group">
									<label for="handle_user_id">最后操作员工：</label>
								</div>
							</td>
							<td align="left">
								<div class="form-group">
									<input type="text" class="form-control" id="handle_user_id" name="handle_user_id" value="${handle_user_id }">
								</div>
							</td>
							<td align="right">
								<div class="form-group">
									<label for="finish_time">完成日期：</label>
								</div>
							</td>
							<td align="left">
								<div class="form-group">
									<input type="date" class="form-control" id="finish_time1" name="finish_time1" value="<f:formatDate value='${finish_time1 }' pattern='yyyy-MM-dd'/>">
									至：
									<input type="date" class="form-control" id="finish_time2" name="finish_time2" value="<f:formatDate value='${finish_time2 }' pattern='yyyy-MM-dd'/>">
								</div>
							</td>
						</tr>
						<!-- 表单按钮组 -->
						<tr align="center">
							<td align="left" colspan="6">
								<button class="btn btn-primary btn-sm" type="submit" name="zjjinquiry" id="zjjinquiry">
									<span class="glyphicon glyphicon-search" aria-hidden="true"></span>&nbsp;&nbsp;查询
								</button>
								&nbsp;&nbsp;
								<button class="btn btn-primary btn-sm" type="button" name="zjjresetting" id="zjjresetting">
									<span class="glyphicon glyphicon-refresh" aria-hidden="true"></span>&nbsp;&nbsp;重置
								</button>
								&nbsp;&nbsp;
								<button class="btn btn-primary btn-sm" type="button" id="export">
									<span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span>&nbsp;&nbsp;导出Excel
								</button>
							</td>
						</tr>
					</table>
				</form>
			
			<!-- 显示数据 -->
			<table class="table table-bordered table-condensed table-hover" id="tab">
				<tr align="center">
					<td></td>
					<td>订单编号</td>
					<td>消费内容</td>
					<td>价格（元）</td>
					<td>支付方式</td>
					<td>实付金额（元）</td>
					<td>消耗颜值</td>
					<td>店铺编号</td>
					<td>店铺名称</td>
					<td>服务员工</td>
					<td>最后操作员工</td>
					<td>订单状态</td>
					<td>支付时间</td>
					<td>完成时间</td>
					<td>查看详情</td>				
				</tr>
				<c:forEach items="${info.list }" var="list" varStatus="s">
						<tr align="center">
							<td>${s.index+1 }</td>
							<td>${list.order_id }</td>
							<td>${list.order_content }</td>
							<td>${list.order_money }</td>
							<td>${list.pay_way=="1"?"微信":list.pay_way=="2"?"支付宝":list.pay_way=="3"?"美颜币":"套餐" }</td>
							<%-- <td>
								<c:if test="${list.pay_way==1 }">
									微信
								</c:if>
								<c:if test="${list.pay_way==2 }">
									支付宝
								</c:if>
								<c:if test="${list.pay_way==3 }">
									美颜币
								</c:if>
								<c:if test="${list.pay_way==4 }">
									套餐
								</c:if>
							</td> --%>
							<td>${list.pay_money }</td>
							<td>${list.extend_beauty_num }</td>
							<td>${list.shop_id }</td>
							<td>${list.shop_name }</td>
							<td>${list.server_user_id }</td>
							<td>${list.handle_user_id }</td>
							<%-- <td>${list.order_status }</td> --%>
							<td>${list.order_status=="0"?"草稿":list.order_status=="1"?"已预约":list.order_status=="2"?"服务中":list.order_status=="3"?"待支付":list.order_status=="4"?"已支付":list.order_status=="5"?"已完成":list.order_status=="6"?"已过期":"已撤销" }</td>
							<%-- <td>
								<c:if test="${list.order_status==0 }">
									草稿
								</c:if>
								<c:if test="${list.order_status==1 }">
									已预约
								</c:if>
								<c:if test="${list.order_status==2 }">
									服务中
								</c:if>
								<c:if test="${list.order_status==3 }">
									待支付
								</c:if>
								<c:if test="${list.order_status==4 }">
									已支付
								</c:if>
								<c:if test="${list.order_status==5 }">
									已完成
								</c:if>
								<c:if test="${list.order_status==6 }">
									已过期
								</c:if>
								<c:if test="${list.order_status==7 }">
									已撤销
								</c:if>
							</td> --%>
							<td>${list.pay_time }</td>
							<td>${list.finish_time }</td>
							<td>
								<button class="btn btn-primary btn-xs" type="button" onclick="test111(this)" data-toggle="modal" data-target="#myModal11" data-backdrop="static">
									<span class="glyphicon glyphicon-search" aria-hidden="true"></span>&nbsp;&nbsp;查看详情
								</button>
							</td>
						</tr>
					</c:forEach>			
			</table>
			
			<!-- 查看详情模态框 -->
			<div class="modal fade bs-example-modal-lg" id="myModal11" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
				<div class="modal-dialog modal-lg" role="document">
					<div class="modal-content">
						<div class="modal-header">
					    	<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
					    	<h4 class="modal-title" align="left">消费情况查看详情</h4>
					    </div>
					    <div class="modal-body">
					    	<fieldset disabled>			      	
						    <table>
						    	<tr>
						      		<td>
						    			<div class="form-group" align="left">
						    				<label for="order_id">订单编号：</label>
						    			</div>
						    		</td>
						    		<td>
						    			<div class="form-group">
											<input type="text" class="form-control" name="order_id" id="order_id1" value="">
										</div>
						    		</td>
						    		<td>
						    			<div class="form-group" align="left">
						    				<label for="order_content">消费内容：</label>
						    			</div>
						    		</td>
						    		<td>
						    			<div class="form-group">
											<input type="text" class="form-control" name="order_content" id="order_content1" value="">
										</div>
						    		</td>
						    		<td>
						    			<div class="form-group" align="left">
						    				<label for="order_money">价格（元）：</label>
						    			</div>
						    		</td>
						    		<td>
						    			<div class="form-group">
											<input type="text" class="form-control" name="order_money" id="order_money1" value="">
										</div>
						    		</td>
						      	</tr>
						      	<tr>
						      		<td>
						    			<div class="form-group" align="left">
						    				<label for="pay_way">支付方式：</label>
						    			</div>
						    		</td>
						    		<td>
						    			<div class="form-group">
											<input type="text" class="form-control" name="pay_way" id="pay_way1" value="">
										</div>
						    		</td>
						    		<td>
						    			<div class="form-group" align="left">
						    				<label for="pay_money">实付金额（元）：</label>
						    			</div>
						    		</td>
						    		<td>
						    			<div class="form-group">
											<input type="text" class="form-control" name="pay_money" id="pay_money1" value="">
										</div>
						    		</td>
						    		<td>
						    			<div class="form-group" align="left">
						    				<label for="extend_beauty_num">消耗颜值：</label>
						    			</div>
						    		</td>
						    		<td>
						    			<div class="form-group">
											<input type="text" class="form-control" name="extend_beauty_num" id="extend_beauty_num1" value="">
										</div>
						    		</td>
						      	</tr>
						      	<tr>
						      		<td>
						    			<div class="form-group" align="left">
						    				<label for="shop_id">店铺编号：</label>
						    			</div>
						    		</td>
						    		<td>
						    			<div class="form-group">
											<input type="text" class="form-control" name="shop_id" id="shop_id1" value="">
										</div>
						    		</td>
						    		<td>
						    			<div class="form-group" align="left">
						    				<label for="shop_name">店铺名称：</label>
						    			</div>
						    		</td>
						    		<td>
						    			<div class="form-group">
											<input type="text" class="form-control" name="shop_name" id="shop_name1" value="">
										</div>
						    		</td>
						    		<td>
						    			<div class="form-group" align="left">
						    				<label for="server_user_id">服务员工：</label>
						    			</div>
						    		</td>
						    		<td>
						    			<div class="form-group">
											<input type="text" class="form-control" name="server_user_id" id="server_user_id1" value="">
										</div>
						    		</td>
						      	</tr>
						      	<tr>
						      		<td>
						    			<div class="form-group" align="left">
						    				<label for="handle_user_id">最后操作员工：</label>
						    			</div>
						    		</td>
						    		<td>
						    			<div class="form-group">
											<input type="text" class="form-control" name="handle_user_id" id="handle_user_id1" value="">
										</div>
						    		</td>
						    		<td>
						    			<div class="form-group" align="left">
						    				<label for="pay_time">支付时间：</label>
						    			</div>
						    		</td>
						    		<td>
						    			<div class="form-group">
											<input type="text" class="form-control" name="pay_time" id="pay_time1" value="">
										</div>
						    		</td>
						    		<td>
						    			<div class="form-group" align="left">
						    				<label for="finish_time">完成时间：</label>
						    			</div>
						    		</td>
						    		<td>
						    			<div class="form-group">
											<input type="text" class="form-control" name="finish_time" id="finish_time3" value="">
										</div>
						    		</td>
						      	</tr>
						    </table>
						    </fieldset>
					   	</div>
					</div>
				</div>
			</div>

			<!-- 分页 -->
			<a href="#" onclick="first()">首页</a>
			&nbsp;&nbsp;&nbsp;
			<a href="#" onclick="pre()">上一页</a>
			&nbsp;&nbsp;&nbsp;
			<a href="#" onclick="next()">下一页</a>
			&nbsp;&nbsp;&nbsp;
			<a href="#" onclick="last()">尾页</a>

	</center>
</body>
<script type="text/javascript">
	//条件查询定值方法
	$(function(){
		$("#pay_way").val('${pay_way}');
		$("#order_status").val('${order_status}');
		$("#shop_id").val('${shop_id}');
	})

	/* function test1(){
		myform.action="${pageContext.request.contextPath }/zjj/selectBis_business_order";
		myform.submit();
	} */
	
	//Excel导出
	$('#export').click(function(){
			var trNum=$("#tab").find("tr").length ;//获取表格行数
			var tdNum=$("#tab").find("tr:eq(0)").find("td").length;//获取表头
			var arr="";
			for(i=0;i<trNum;i++){
				var str="";
				/* for(j=1;j<tdNum-1;j++){ */
				for(j=0;j<tdNum;j++){
					var info=$("#tab tr:eq("+i+") td:eq("+j+")").text();
					str=str+info+",";
				}
				str=str.substring(0,str.length-1);
				arr=arr+str+"%26";
			}
			window.location.href="${pageContext.request.contextPath }/zjj/export?arr="+arr;
	});
	
	//分页
	//首页
	function first(){
		document.forms[0].action="${pageContext.request.contextPath }/zjj/selectBis_business_order?page=${info.firstPage}";
		document.forms[0].submit();
	}
	//上一页
	function pre(){
		document.forms[0].action="${pageContext.request.contextPath }/zjj/selectBis_business_order?page=${info.prePage}";
		document.forms[0].submit();
	}
	//下一页
	function next(){
		document.forms[0].action="${pageContext.request.contextPath }/zjj/selectBis_business_order?page=${info.nextPage}";
		document.forms[0].submit();
	}
	//尾页
	function last(){
		document.forms[0].action="${pageContext.request.contextPath }/zjj/selectBis_business_order?page=${info.lastPage}";
		document.forms[0].submit();
	}
	
	//点击重置按钮 重置
	$("#zjjresetting").click(
		function() {
			$("#order_id").val("");
			$("#order_content").val("");
			$("#pay_way").val("");
			$("#order_status").val("");
			$("#shop_id").val("");
			$("#server_user_id").val("");
			$("#handle_user_id").val("");
			$("#finish_time1").val("");
			$("#finish_time2").val("");
		}
	);
	
	//点击查看详情将当前行数据传递到模态框
	function test111(obj) {
		//获取当前点击行的id
		var $td = $(obj).parents('tr').children('td');
		var id = $td.eq(1).text();
		$("#order_id1").val(id);//将获取的该行的id值填充到模态框的文框中，文本框的ID为itemmodalid，其他的数据也是如此处理
		var order_content1 = $td.eq(2).text();
		$("#order_content1").val(order_content1);
		var order_money1 = $td.eq(3).text();
		$("#order_money1").val(order_money1);
		
		var pay_way1 = $td.eq(4).text();
		$("#pay_way1").val(pay_way1);
		var pay_money1 = $td.eq(5).text();
		$("#pay_money1").val(pay_money1);
		var extend_beauty_num1 = $td.eq(6).text();
		$("#extend_beauty_num1").val(extend_beauty_num1);
		
		var shop_id1 = $td.eq(7).text();
		$("#shop_id1").val(shop_id1);
		var shop_name1 = $td.eq(8).text();
		$("#shop_name1").val(shop_name1);
		var server_user_id1 = $td.eq(9).text();
		$("#server_user_id1").val(server_user_id1);
		
		var handle_user_id1 = $td.eq(10).text();
		$("#handle_user_id1").val(handle_user_id1);
		var pay_time1 = $td.eq(11).text();
		$("#pay_time1").val(pay_time1);
		var finish_time3 = $td.eq(12).text();
		$("#finish_time3").val(finish_time3);
	}
</script>
</html>